Tootsville::Get-Mariadb-Lock

Function

Get-Mariadb-Lock names a function, with lambda list (LOCK-STRING &KEY IF-NOT-LOCKED TIMEOUT):

Obtain database lock LOCK-STRING.

See TOOTSVILLE WITH-CLUSTER-WIDE-LOCK-HELD for a practical use of this.

LOCK-STRING is passed to the MariaDB server and a global lock by that name is obtained via mySQL function GET_LOCK(STRING), if possible.

If the lock is busy, IF-NOT-LOCKED determines the next action.

:WAIT

Wait for up to TIMEOUT seconds for the lock to be freed. If the lock cannot be obtained within TIMEOUT seconds, signal an error of type CLUSTER-WIDE-LOCK-BUSY-ERROR. If TIMEOUT is NIL, wait indefinitely until the lock can be obtained.

:SKIP

Skip BODY and return NIL.

:WARN

Signal a warning of type CLUSTER-WIDE-LOCK-BUSY-WARNING, then skip BODY and return NIL.

:ERROR

Signal an error of type CLUSTER-WIDE-LOCK-BUSY-ERROR.

Returns an opaque identifier that can be passed to ‘YIELD-DB-LOCK’ to release the lock.

LOCK-NAME is case-insensitive.

File

Defined in file src/db/maria.lisp.